#include <stdio.h>
#include <stdlib.h>

void sort(int n, int nums[n]);

#define N 10001

int main(int argc, char *argv[])
{
    int n = 0;
    scanf("%d", &n);

    int nums[N] = {0};
    for (size_t i = 0; i < n; i++)
    {
        int num = 0;
        scanf("%d", &num);
        nums[num] += 1;
    }

    //重新整理
    int noSortArr[100] = {0}, index = -1, count = 0;
    for (size_t i = 0; i < N; i++)
    {
        if(nums[i]>0){
            noSortArr[++index] = i;
            count++;
        }
    }
    printf("%d\n", count);
    sort(index+1, noSortArr);

    return 0;
}


void sort(int n,int nums[]){
    for (size_t i = 0; i < n; i++)
    {
        for (size_t z = i+1; z < n; z++)
        {
            int temp = 0;
            if(nums[i]>nums[z]){
                temp = nums[z];
                nums[z] = nums[i];
                nums[i] = temp;
            }
        }
    }

    for (size_t i = 0; i < n; i++)
    {
        printf("%d ", nums[i]);
    }
}